package com.xiashitech.buildservice.plugin;

import org.gradle.api.Plugin;
import org.gradle.api.Project;

import java.io.File;

public class InitJarPlugin implements Plugin<Project> {
    @Override
    public void apply(Project project) {
        String path = project.getProperties().get("buildDir") + File.separator + project.getProperties().get("libsDirName") + File.separator;
        String jarName = project.getName()+"-"+project.getVersion()+"-all.jar";
        project.getTasks().create("initJar").doLast(task -> {
            InitJar.init(path + jarName);
        }).dependsOn("shadowJar");
    }
}
